Skip to content

Conversation

@VedantMadane
Copy link

Summary

Fix the default interpolation method for MobileNet v1 and v2 image processors from BILINEAR to BICUBIC, matching the original timm implementation.

Motivation

As part of #28180, we need to verify that image processor interpolation methods match their original implementations. The MobileNet models in timm use BICUBIC interpolation for preprocessing, but the transformers image processors were defaulting to BILINEAR.

Changes

  • mobilenet_v1/image_processing_mobilenet_v1.py: Changed default resample from PILImageResampling.BILINEAR to PILImageResampling.BICUBIC
  • mobilenet_v2/image_processing_mobilenet_v2.py: Changed default resample from PILImageResampling.BILINEAR to PILImageResampling.BICUBIC

Verification

The timm documentation confirms MobileNet models use bicubic interpolation:

Contributes to #28180

The MobileNet image processors were defaulting to BILINEAR interpolation, but the original timm implementation uses BICUBIC. This change aligns transformers with timm's preprocessing.

Contributes to huggingface#28180
@Rocketknight1
Copy link
Member

cc @NielsRogge if that issue is still relevant! If not we should close it, since I think a lot of people and code agents are searching for old open issues lately

Update MobileNetV1ImageProcessorFast and MobileNetV2ImageProcessorFast
to use PILImageResampling.BICUBIC instead of BILINEAR, matching the
changes made to the slow image processors.
@github-actions
Copy link
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: mobilenet_v1, mobilenet_v2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants